home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / include / resolv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  6.4 KB  |  165 lines  |  [TEXT/R*ch]

  1. /*-
  2.  * Copyright (c) 1983, 1987, 1989, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)resolv.h    8.1 (Berkeley) 6/2/93
  34.  *    $Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $
  35.  * -
  36.  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
  37.  * 
  38.  * Permission to use, copy, modify, and distribute this software for any
  39.  * purpose with or without fee is hereby granted, provided that the above
  40.  * copyright notice and this permission notice appear in all copies, and that
  41.  * the name of Digital Equipment Corporation not be used in advertising or
  42.  * publicity pertaining to distribution of the document or software without
  43.  * specific, written prior permission.
  44.  * 
  45.  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  46.  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  47.  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
  48.  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  49.  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  50.  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  51.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  52.  * SOFTWARE.
  53.  * -
  54.  * --Copyright--
  55.  */
  56.  
  57. #ifndef _RESOLV_H_
  58. #define    _RESOLV_H_
  59.  
  60. #include <sys/types.h>
  61. /*
  62.  * Resolver configuration file.
  63.  * Normally not present, but may contain the address of the
  64.  * inital name server(s) to query and the domain search list.
  65.  */
  66.  
  67. #ifndef _PATH_RESCONF
  68. #define _PATH_RESCONF        "/etc/resolv.conf"
  69. #endif
  70.  
  71. /*
  72.  * Global defines and variables for resolver stub.
  73.  */
  74. #define    MAXNS            3    /* max # name servers we'll track */
  75. #define    MAXDFLSRCH        3    /* # default domain levels to try */
  76. #define    MAXDNSRCH        6    /* max # domains in search path */
  77. #define    LOCALDOMAINPARTS    2    /* min levels in name that is "local" */
  78.  
  79. #define    RES_TIMEOUT        5    /* min. seconds between retries */
  80.  
  81. struct __res_state {
  82.     int    retrans;         /* retransmition time interval */
  83.     int    retry;            /* number of times to retransmit */
  84.     long    options;        /* option flags - see below. */
  85.     int    nscount;        /* number of name servers */
  86.     struct    sockaddr_in nsaddr_list[MAXNS];    /* address of name server */
  87. #define    nsaddr    nsaddr_list[0]        /* for backward compatibility */
  88.     u_short    id;            /* current packet id */
  89.     char    *dnsrch[MAXDNSRCH+1];    /* components of domain to search */
  90.     char    defdname[MAXDNAME];    /* default domain */
  91.     long    pfcode;            /* RES_PRF_ flags - see below. */
  92. };
  93.  
  94. /*
  95.  * Resolver options (keep these in synch with res_debug.c, please)
  96.  */
  97. #define RES_INIT    0x0001        /* address initialized */
  98. #define RES_DEBUG    0x0002        /* print debug messages */
  99. #define RES_AAONLY    0x0004        /* authoritative answers only */
  100. #define RES_USEVC    0x0008        /* use virtual circuit */
  101. #define RES_PRIMARY    0x0010        /* query primary server only */
  102. #define RES_IGNTC    0x0020        /* ignore trucation errors */
  103. #define RES_RECURSE    0x0040        /* recursion desired */
  104. #define RES_DEFNAMES    0x0080        /* use default domain name */
  105. #define RES_STAYOPEN    0x0100        /* Keep TCP socket open */
  106. #define RES_DNSRCH    0x0200        /* search up local domain tree */
  107.  
  108. #define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
  109.  
  110. /*
  111.  * Resolver "pfcode" values.  Used by dig.
  112.  */
  113. #define RES_PRF_STATS    0x0001
  114. /*            0x0002    */
  115. #define RES_PRF_CLASS   0x0004
  116. #define RES_PRF_CMD    0x0008
  117. #define RES_PRF_QUES    0x0010
  118. #define RES_PRF_ANS    0x0020
  119. #define RES_PRF_AUTH    0x0040
  120. #define RES_PRF_ADD    0x0080
  121. #define RES_PRF_HEAD1    0x0100
  122. #define RES_PRF_HEAD2    0x0200
  123. #define RES_PRF_TTLID    0x0400
  124. #define RES_PRF_HEADX    0x0800
  125. #define RES_PRF_QUERY    0x1000
  126. #define RES_PRF_REPLY    0x2000
  127. #define RES_PRF_INIT    0x4000
  128. /*            0x8000    */
  129.  
  130. #include <sys/cdefs.h>
  131. #include <stdio.h>
  132.  
  133. extern struct __res_state _res;
  134.  
  135. /* Private routines shared between libc/net, named, nslookup and others. */
  136. #define    dn_skipname    __dn_skipname
  137. #define    fp_query    __fp_query
  138. #define    hostalias    __hostalias
  139. #define    putlong        __putlong
  140. #define    putshort    __putshort
  141. #define p_class        __p_class
  142. #define p_time        __p_time
  143. #define p_type        __p_type
  144. __BEGIN_DECLS
  145. int     __dn_skipname __P((const u_char *, const u_char *));
  146. void     __fp_resstat __P((struct __res_state *, FILE *));
  147. void     __fp_query __P((char *, FILE *));
  148. char    *__hostalias __P((const char *));
  149. void     __putlong __P((u_int32_t, u_char *));
  150. void     __putshort __P((u_short, u_char *));
  151. char    *__p_class __P((int));
  152. char    *__p_time __P((u_int32_t));
  153. char    *__p_type __P((int));
  154.  
  155. int     dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
  156. int     dn_expand __P((const u_char *, const u_char *, const u_char *,
  157.             u_char *, int));
  158. int     res_init __P((void));
  159. int     res_mkquery __P((int, const char *, int, int, const char *, int,
  160.               const char *, char *, int));
  161. int     res_send __P((const char *, int, char *, int));
  162. __END_DECLS
  163.  
  164. #endif /* !_RESOLV_H_ */
  165.